package com.alpaak.common.enumtype;

/**
 * 注意：修改时，接口文档做对应修改
 */
public enum ErrorCodeEnum {
	
	
	/*********************************统一接入基础功能错误号***************************************/
	
	NUKOWN_ERROR("NUKOWN_ERROR","系统异常,请联系管理员"),
	
	SYS_ERR("10000001","操作失败，系统异常:"),
	SYS_UNLOGIN("10000000","登录超时，请重新登录"),
	SYS_HTTP_URL_NOT_EXIST("10000002","Http请求地址错误"),
	SUM_EFFECTIVE_ERROR("10000101","当前UTC时间戳不在有效期内！"),
	
	SUM_KEY_NOT_EXIST("10000102","秘钥在系统当中不存在！"),
	CUSTOMER_HAVE_ORDER("10000102","秘钥在系统当中不存在！"),
	SUM_NOT_MATCH("10000103","签名不匹配！"),
	
	FILE_IO("10000104","文件读写流异常！"),
	FILE_NOT_FOUND("10000105","文件未找到！"),
	GET_WARDNO_ERROR("GET_WARDNO_ERROR","根据设备号获取病区号异常"),
	PARSE_JSON_ERROR("PARSE_JSON_ERROR","json解析异常"),
	HTTP_POST_ERROR("HTTP_POST_ERROR","HTTP请求异常"),
	
	HELE_ERROR("10000201","该客户订购的服务包不支持处理该任务"),
	EQUIPMENT_BUNDED("10000301","该设备已经绑定客户,是否强制绑定"),
	CUSTOMER_INFO_ERROR("10000401","该客户信息不完善,无法处理"),
	PARAM_VALID_ERROR("PARAM_VALID_ERROR","参数校验不通过：%s"),
    MOBILE_ERROR("MOBILE_ERROR","手机号码不能为空"),
    CARD_ID_ERROR("10000501","身份证号码有误"),
    MOBILE_REGISTED("MOBILE_REGISTED","该手机号码已经注册"),
    NAME_ERROR("NAME_ERROR","姓名不能为空"),
    MINDEX_ERROR("MINDEX_ERROR","客户主索引不能为空"),
    SERVICE_ORDER_EXIST("SERVICE_ORDER_EXIST","已订购该服务包，不可重复订购"),
    CUSTOMER_ERROR("CUSTOMER_ERROR","用户不存在"),
    CUSTOMER_ERROR_H5("CUSTOMER_ERROR","该用户不存在，请联系智汇健康"),
    CUSTOMER_EXIST("CUSTOMER_EXIST","用户已存在"),
    SOCIAL_WELFARE_NOT_EXIST("SOCIAL_WELFARE_NOT_EXIST","该机构不存在"),
    SOCIAL_WELFARE_EXIST("SOCIAL_WELFARE_EXIST","该机构已存在"),
    CUSTOMER_NOT_EXIST("10000501","客户不存在"),    
    CUSTOMER_BELONG_SOCIALWELFARE("10000502","该机构下存在客户，不允许删除该机构"),
    CUSTOMER_WELFAREIDUPLICATE_SOCIALWELFARE("10000503","机构代码重复"), 
    CUSTOMER_SHOES_ISBUND("CUSTOMER_SHOES_ISBUND","该客户已绑定此设备"),
    CUSTOMER_EQUIPMENT_ISBUND("CUSTOMER_EQUIPMENT_ISBUND","该客户已绑定设备"), 
    CUSTOMER_CARD_ISBUND("CUSTOMER_CARD_ISBUND","该客户已绑定设备"), 
    VERIFY_CODE_NULL("VERIFY_CODE_NULL","手机验证码不能为空"),
    USER_NAME_ERROR("USER_NAME_ERROR","用户名不能为空"),
    USER_NAME_EXIST("USER_NAME_EXIST","用户名已存在"),
    USER_ERROR("LOGIN_ERROR","用户或密码错误"),
    PASSWORD_ERROR("PASSWORD_ERROR","密码不能为空"),
    PSD_ERROR("LOGIN_ERROR","用户或密码错误"),
    OLD_PSD_ERROR("OLD_PSD_ERROR","原密码错误"),
    DELETE_ERROR("DELETE_ERROR","已绑定客户,无法删除"),
    DELETE_CUSTOMER_ERROR("DELETE_CUSTOMER_ERROR","客户已录入数据，不可以删除"),
    USER_NAME_HAVE_ERROR("USER_NAME_HAVE_ERROR","用户名已注册"),
    USER_MOBILE_HAVE_ERROR("USER_MOBILE_HAVE_ERROR","手机号码已注册"),
    CARID_REGISTED("CARID_REGISTED","身份号码已经注册"),
    VERIFY_CODE_ERROR("VERIFY_CODE_ERROR","手机验证码无效"),
    THE_ORDER_HAS_BEEN_STARTED("THE_ORDER_HAS_BEEN_STARTED","该订单已启动"),
    ONLY_THE_ORDER_HAS_BEEN_STARTED_TO_STOP("ONLY_THE_ORDER_HAS_BEEN_STARTED_TO_STOP","只有已启动的订单才允许停止"),
    MOBILE_MORE_THAN_ONE("MOBILE_MORE_THAN_ONE","该手机号存在多个"),
    CARDID_MORE_THAN_ONE("CARDID_MORE_THAN_ONE","该身份证号存在多个"),
    RESOURCE_EQUIPMENTNO_NOT_EXIST("RESOURCE_EQUIPMENTNO_NOT_EXIST","该来源设备号不存在"),
    FILE_OUTPUT_FAIL("FILE_OUTPUT_FAIL","文件导出失败"),
    UNBINDSIGNCARD_ERROR("UNBINDSIGNCARD_ERROR","调用解绑体征卡接口失败"),
    BINDSIGNCARD_ERROR("BINDSIGNCARD_ERROR","调用绑定体征卡接口失败"),
    TIME_CONVERSION_ERROR("TIME_CONVERSION_ERROR","时间转换错误"),
    TIME_FORMAT_ERROR("TIME_FORMAT_ERROR","时间格式不匹配"),
    BEDB_DATA_ERROR("BEDB_DATA_ERROR","智能床实时数据处理失败"),
    MQTT_SERVER_ERROR("MQTT_SERVER_ERROR","mqtt服务使用失败"),
    QUARTZ_ERROR("QUARTZ_ERROR","定时器异常"),
    ;
    

    private String errMsg;

    private String errCode;

    private ErrorCodeEnum(String errCode, String errMsg){
        this.errCode = errCode;
        this.errMsg = errMsg;
    }

    private ErrorCodeEnum(String errCode){
        this.errCode = errCode;
    }

    public static ErrorCodeEnum getTbcpErrorCodeEnum(String code) {
        for(ErrorCodeEnum x: ErrorCodeEnum.values()) {
            if(x.getErrCode().equals(code)) {
                return x;
            }
        }
        return null;
    }

    public static String getErrorCodeEnumValue(String code){
        for(ErrorCodeEnum x: ErrorCodeEnum.values()) {
            if(x.getErrCode().equals(code)) {
                return x.getErrMsg();
            }
        }
        
        return "";
    }
    
    public String getErrCode(){
        return this.errCode;
    }

    public String getErrMsg(){
        return this.errMsg;
    }
}
